﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

namespace Jy123.Web.Manage.Album
{
    public partial class AlbumList : MgConfig//System.Web.UI.Page
    {
        protected int pagesize = 10;
        protected int cpage = 1;//当前页
        protected List<int?> count;
        protected void Page_Load(object sender, EventArgs e)
        {
            Verify("AlbumList.aspx");
            if (Request.QueryString["page"] != null)
            {
                cpage = Convert.ToInt32(Request.QueryString["page"]);
            }
            //RptData.DataSource = new BLL.User.Album().ManageAlbumList(150, "");
            RptData.DataSource = new BLL.User.Album().ManageAlbumList(cpage, pagesize, "",out count);
            RptData.DataBind();
        }

        //搜索
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            if (Key.Text != null)
            {
                //RptData.DataSource = new BLL.User.Album().ManageAlbumList(150, "UserName like '%" + Key.Text.Trim() + "%'");
                RptData.DataSource = new BLL.User.Album().ManageAlbumList(cpage, pagesize, "UserName like '%" + Key.Text.Trim() + "%'",out count);
                RptData.DataBind();
            }
        }

        //删除相册(未处理物理文件)
        protected void btnDel_Click(object sender, EventArgs e)
        {
            string ids = Request.Form["albumchkedid"];
            if (string.IsNullOrEmpty(ids))
            {
                Response.Redirect("index.aspx?" + Request.QueryString + "&DivErr=请选择一个项目。");
            }
            string[] id = ids.Split(',');
            for (int i = 0; i < id.Length; i++)
            {
                //delAlbumfuc(Convert.ToInt32(id[i]));
                new BLL.User_Album().Delete(Convert.ToInt32(id[i]));
            }
            Response.Redirect(Request.RawUrl);
        }
    }
}
